/*
 * @Author: LCL 
 * @Date: 2018-06-19 20:45:21
 * @Desc: 存储数据
 */

// import { HallUserModel } from "../view/login/HallUserModel";

export class KingStorage {
    // isBindUser 是否为对象
    setItem(key: string, value, isBindUser: boolean = true) {
        key = this.getKey(key, isBindUser);
        cc.sys.localStorage.setItem(key, JSON.stringify(value));
        
    }

    getItem(key: string, isBindUser: boolean = true): any {
        key = this.getKey(key, isBindUser);
        return JSON.parse(cc.sys.localStorage.getItem(key) || String(isBindUser));
    }

    getKey(key: string, isBindUser: boolean): string {
        // if (isBindUser && HallUserModel.getInstance().getUserID() != "") {
        //     key = HallUserModel.getInstance().getUserID() + "_" + key;
        // }
        return key;
    }

    removeItem(key: string, isBindUser) {
        key = this.getKey(key, isBindUser);
        cc.sys.localStorage.removeItem(key);
    }
}


/*
public void TEXT1() 
{
	int textNum = 1;
	if (textNum == 1) 
	{
		textNum = 2;
    }
}
public void TEXT2()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}
public void TEXT3()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT4()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT5()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT6()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT8()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT9()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT10()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT11()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT12()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT13()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT14()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT15()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT16()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT17()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}
*/